1013A - Piles With Stones - CodeForces Solution


math *800

Please click on ads to support us..

Python Code:

n = int(input())
q = list(map(int, input().split()))
s = list(map(int, input().split()))

if sum(q) >= sum(s):
    print("YES")

else:
    print("NO")

C++ Code:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> v;
typedef unordered_map<int, int> mp;
typedef vector<ll> vll;
#define nl cout << endl;
#define F first
#define S second
#define pf pop_back
#define pb push_back
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define all(v) v.begin(), v.end()
#define dec(v) v.rbegin(), v.rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define decimal(n) fixed << setprecision(n)
#define fast                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cin.tie(nullptr);             \
	cout.tie(nullptr);
// #define d 1000000007
#define lu unsigned long long int

void solve()
{
	int n;
	cin >> n;
	int a[n], b[n], s1 = 0, s2 = 0;
	rep(i, n)
	{
		cin >> a[i];
		s1 += a[i];
	}
	rep(i, n)
	{
		cin >> b[i];
		s2 += b[i];
	}
	if (s1 >= s2)
		yes;
	else
		no;
}
int main()
{
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	fast;
	ll t = 1;
	// cin >> t;
	while (t--)
	{
		solve();
	}
}


Comments

Submit
0 Comments
More Questions

Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people
Book of Potion making
Duration
Birthday Party
e-maze-in
Bricks Game
Char Sum
Two Strings
Anagrams
Prime Number
Lexical Sorting Reloaded
1514A - Perfectly Imperfect Array
580A- Kefa and First Steps
1472B- Fair Division
996A - Hit the Lottery
MSNSADM1 Football
MATCHES Playing with Matches
HRDSEQ Hard Sequence
DRCHEF Doctor Chef
559. Maximum Depth of N-ary Tree
821. Shortest Distance to a Character
1441. Build an Array With Stack Operations